package gui;

import java.awt.BorderLayout;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class AboutGUI {
	private JFrame aboutFrame;
	private JButton okBtn;
	private JLabel aboutText, image;
	private JPanel p, p1;

	public AboutGUI() {
	
		p = new JPanel(new FlowLayout());
		
		aboutText = new JLabel("<html>Dette program er designet og kodet af Ilhami og Engin. <br>" +
				"Tak til alle støttere!<br><br><br>Administration system vers. 1.0<br>Copyright© All rights reserved</html>");
		
		p.add(aboutText);
		
		p1 = new JPanel(new FlowLayout(FlowLayout.RIGHT));
		
		okBtn = new JButton("OK");
		okBtn.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				aboutFrame.setVisible(false);
			}
		});
		
		p1.add(okBtn);

	}
	
	public void showGUI() {
		aboutFrame = new JFrame();
		Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); 
		int w = aboutFrame.getSize().width;
		int h = aboutFrame.getSize().height;
		int x = (dim.width-w)/4;
		int y = (dim.height-h)/5;
		aboutFrame.setLocation(x, y);
		aboutFrame.setTitle("About");
		aboutFrame.setLayout(new BorderLayout());
		aboutFrame.setSize(400, 200);
		aboutFrame.setResizable(false);
		aboutFrame.add(p, BorderLayout.CENTER);
		aboutFrame.add(p1, BorderLayout.SOUTH);
		aboutFrame.setVisible(true);
	}
}
